package lesson17.cars;


public class Car {

	protected String model;
	private double maxSpeed;
	protected double currentSpeed;
	protected int currentGear;
	protected int numberOfDoors;
	protected int idNumber;
	protected boolean isSportsCar;
	protected Person owner;
	
	protected String type = "Just a car";
	
	Car(double maxSpeed)
	{
		this.maxSpeed = maxSpeed;
	}
	
	protected void changeOwner(Person newOwner)
	{
		this.owner = newOwner;
	}
	
	protected void startEngine()
	{
		System.out.println("Brum brum");
	}
	
	protected void changeGear(int gear)
	{
		if (gear >= 1 && gear <= 5)
		{
			this.currentGear = gear;
		}
	}
	
	protected void accelerate(double speed)
	{
		if (this.currentSpeed + speed <= this.maxSpeed)
		{
			this.currentSpeed += speed;
		}
		else
		{
			this.currentSpeed = this.maxSpeed;
		}
		
		System.out.println("Now driving at " + this.currentSpeed);
	}
	
	@Override
	public String toString() 
	{
		
		return "Model: " + this.model + "\n" + "Max speed: " + this.maxSpeed;
	}
	
}
